<script setup lang="ts">
import TheWelcome from '../components/TheWelcome.vue'
</script>

<template>
  <div class="home-container">
    <!-- 欢迎区域 -->
    <div class="welcome-section">
      <div class="welcome-card">
        <div class="welcome-content">
          <div class="welcome-header">
            <h1 class="welcome-title">欢迎使用管理平台</h1>
            <p class="welcome-subtitle">高效、安全、便捷的管理系统</p>
          </div>
          <div class="welcome-stats">
            <div class="stat-item">
              <div class="stat-icon">
                <el-icon>
                  <Key />
                </el-icon>
              </div>
              <div class="stat-content">
                <div class="stat-number">12</div>
                <div class="stat-label">权限总数</div>
              </div>
            </div>
            <div class="stat-item">
              <div class="stat-icon">
                <el-icon>
                  <Avatar />
                </el-icon>
              </div>
              <div class="stat-content">
                <div class="stat-number">8</div>
                <div class="stat-label">角色总数</div>
              </div>
            </div>
            <div class="stat-item">
              <div class="stat-icon">
                <el-icon>
                  <User />
                </el-icon>
              </div>
              <div class="stat-content">
                <div class="stat-number">156</div>
                <div class="stat-label">用户总数</div>
              </div>
            </div>
          </div>
        </div>
        <div class="welcome-illustration">
          <div class="illustration-bg">
            <el-icon class="illustration-icon">
              <Setting />
            </el-icon>
          </div>
        </div>
      </div>
    </div>

    <!-- 快速操作区域 -->
    <div class="quick-actions">
      <div class="section-header">
        <h2 class="section-title">快速操作</h2>
        <p class="section-subtitle">常用功能快速访问</p>
      </div>
      <div class="action-grid">
        <div class="action-card" @click="$router.push('/PermissionGet')">
          <div class="action-icon-wrapper">
            <el-icon class="action-icon">
              <Key />
            </el-icon>
          </div>
          <div class="action-content">
            <h3>权限管理</h3>
            <p>管理系统权限配置</p>
            <div class="action-arrow">
              <el-icon>
                <ArrowRight />
              </el-icon>
            </div>
          </div>
        </div>
        <div class="action-card" @click="$router.push('/RoleGet')">
          <div class="action-icon-wrapper">
            <el-icon class="action-icon">
              <Avatar />
            </el-icon>
          </div>
          <div class="action-content">
            <h3>角色管理</h3>
            <p>管理用户角色分配</p>
            <div class="action-arrow">
              <el-icon>
                <ArrowRight />
              </el-icon>
            </div>
          </div>
        </div>
        <div class="action-card">
          <div class="action-icon-wrapper">
            <el-icon class="action-icon">
              <User />
            </el-icon>
          </div>
          <div class="action-content">
            <h3>用户管理</h3>
            <p>管理系统用户信息</p>
            <div class="action-arrow">
              <el-icon>
                <ArrowRight />
              </el-icon>
            </div>
          </div>
        </div>
        <div class="action-card">
          <div class="action-icon-wrapper">
            <el-icon class="action-icon">
              <Setting />
            </el-icon>
          </div>
          <div class="action-content">
            <h3>系统设置</h3>
            <p>配置系统参数</p>
            <div class="action-arrow">
              <el-icon>
                <ArrowRight />
              </el-icon>
            </div>
          </div>
        </div>
      </div>
    </div>

    <!-- 系统信息 -->
    <div class="system-info">
      <div class="section-header">
        <h2 class="section-title">系统信息</h2>
        <p class="section-subtitle">实时系统状态</p>
      </div>
      <div class="info-grid">
        <div class="info-card">
          <div class="info-icon">
            <el-icon>
              <Document />
            </el-icon>
          </div>
          <div class="info-content">
            <h4>系统版本</h4>
            <p>v1.0.0</p>
          </div>
        </div>
        <div class="info-card">
          <div class="info-icon">
            <el-icon>
              <Clock />
            </el-icon>
          </div>
          <div class="info-content">
            <h4>最后更新</h4>
            <p>2024-01-15</p>
          </div>
        </div>
        <div class="info-card">
          <div class="info-icon">
            <el-icon>
              <Monitor />
            </el-icon>
          </div>
          <div class="info-content">
            <h4>在线用户</h4>
            <p>23</p>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<style scoped>
.home-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0;
}

.welcome-section {
  margin-bottom: 3rem;
}

.welcome-card {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  border-radius: 24px;
  padding: 3rem;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 12px 40px rgba(30, 41, 59, 0.3);
  position: relative;
  overflow: hidden;
}

.welcome-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 200px;
  height: 200px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(29, 78, 216, 0.2) 100%);
  border-radius: 50%;
  transform: translate(50%, -50%);
}

.welcome-header {
  margin-bottom: 2.5rem;
}

.welcome-title {
  font-size: 2.8rem;
  font-weight: bold;
  margin-bottom: 0.8rem;
  background: linear-gradient(135deg, #fff 0%, #e2e8f0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-subtitle {
  font-size: 1.2rem;
  opacity: 0.9;
  color: #cbd5e1;
}

.welcome-stats {
  display: flex;
  gap: 2.5rem;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.stat-icon .el-icon {
  font-size: 1.5rem;
  color: #fff;
}

.stat-content {
  display: flex;
  flex-direction: column;
}

.stat-number {
  font-size: 2.2rem;
  font-weight: bold;
  margin-bottom: 0.3rem;
  color: #fff;
}

.stat-label {
  font-size: 0.9rem;
  opacity: 0.8;
  color: #cbd5e1;
}

.welcome-illustration {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.illustration-bg {
  width: 120px;
  height: 120px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(29, 78, 216, 0.1) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(59, 130, 246, 0.2);
}

.illustration-icon {
  font-size: 4rem;
  opacity: 0.6;
  color: #3b82f6;
}

.section-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.section-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: #1e293b;
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  border-radius: 2px;
}

.section-subtitle {
  font-size: 1rem;
  color: #64748b;
  margin-top: 1rem;
}

.quick-actions {
  margin-bottom: 3rem;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}

.action-card {
  background: white;
  border-radius: 20px;
  padding: 2rem;
  cursor: pointer;
  transition: all 0.4s ease;
  border: 2px solid transparent;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  position: relative;
  overflow: hidden;
}

.action-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.action-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15);
  border-color: #3b82f6;
}

.action-card:hover::before {
  transform: scaleX(1);
}

.action-icon-wrapper {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  transition: all 0.3s ease;
}

.action-card:hover .action-icon-wrapper {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

.action-icon {
  font-size: 2rem;
  color: #64748b;
  transition: all 0.3s ease;
}

.action-card:hover .action-icon {
  color: #fff;
}

.action-content {
  position: relative;
}

.action-content h3 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 0.8rem;
  color: #1e293b;
}

.action-content p {
  color: #64748b;
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 1rem;
}

.action-arrow {
  position: absolute;
  top: 0;
  right: 0;
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.action-card:hover .action-arrow {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  transform: translateX(4px);
}

.action-arrow .el-icon {
  color: #64748b;
  transition: all 0.3s ease;
}

.action-card:hover .action-arrow .el-icon {
  color: #fff;
}

.system-info {
  margin-bottom: 3rem;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}

.info-card {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  transition: all 0.3s ease;
  border: 1px solid #e2e8f0;
}

.info-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
  border-color: #3b82f6;
}

.info-icon {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.info-card:hover .info-icon {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

.info-icon .el-icon {
  font-size: 1.5rem;
  color: #64748b;
  transition: all 0.3s ease;
}

.info-card:hover .info-icon .el-icon {
  color: #fff;
}

.info-content h4 {
  font-size: 0.9rem;
  color: #64748b;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.info-content p {
  font-size: 1.4rem;
  font-weight: 700;
  color: #1e293b;
}

@media (max-width: 768px) {
  .welcome-card {
    flex-direction: column;
    text-align: center;
    padding: 2rem;
  }

  .welcome-title {
    font-size: 2rem;
  }

  .welcome-stats {
    justify-content: center;
    flex-wrap: wrap;
  }

  .action-grid {
    grid-template-columns: 1fr;
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .stat-item {
    flex-direction: column;
    text-align: center;
  }
}
</style>
